package br.com.fabrica.aid.aid_fabrica.view;

import javax.inject.Inject;
import br.com.fabrica.aid.aid_fabrica.business.HomologacaoBC;
import br.com.fabrica.aid.aid_fabrica.domain.Homologacao;
import br.gov.frameworkdemoiselle.annotation.PreviousView;
import br.gov.frameworkdemoiselle.stereotype.ViewController;
import br.gov.frameworkdemoiselle.template.AbstractEditPageBean;
import br.gov.frameworkdemoiselle.transaction.Transactional;

@ViewController
@PreviousView("./homologacao_list.xhtml")
public class HomologacaoEditMB extends AbstractEditPageBean<Homologacao, Long>{

	private static final long serialVersionUID = 1L;

	@Inject
	private HomologacaoBC homologacaoBC;

	@Override
	@Transactional
	public String delete() {
		this.homologacaoBC.delete(getId());
		return getPreviousView();
	}

	@Override
	@Transactional
	public String insert() {
		this.homologacaoBC.insert(getBean());
		return getPreviousView();
	}

	@Override
	@Transactional
	public String update() {
		this.homologacaoBC.update(getBean());
		return getPreviousView();
	}

	@Override
	protected void handleLoad() {
		setBean(this.homologacaoBC.load(getId()));
	}


}